<template>
	
		<!-- 顶部导航 -->
		<view class="uni-tab-bar">
			<scroll-view scroll-x class="uni-swiper-tab" :style="scrollStyle"
					show-scrollbar="false">
					
				<block v-for="(tab,index) in tabBars" :key="tab.id">
					
					<view class="swiper-tab-list" 
					:class="{'active' : tabIndex == index}" 
					@tap="tabtap(index)" :style="scrollItemStyle">
					
						{{tab.name}}
						
						<view class="swiper-tab-line"></view>
					</view>
				</block>
				
			</scroll-view>
		</view>
		

</template>

<script>
	export default {
		props:{
			tabBars:Array,
			tabIndex:Number,
			scrollStyle:{
				type:String,
				default:""
			},
			scrollItemStyle:{
				type:String,
				default:""
			}
		},
		methods:{
			// 根据点击改变tabBar
			tabtap(index){
				this.$emit('tabtap',index)
			}
		}
	}
</script>

<style>
	.swiper-tab-list{
		color: #969696;
		font-weight: bold;
	}
	.uni-tab-bar .active{
		color: #343434;
	}
	.active .swiper-tab-line{
		border-bottom: 6upx solid #FEDE33;
		width: 70upx;
		margin: 0 auto;
		border-top: 6upx solid #FEDE33;
		border-radius: 20upx;
		
	}
	.uni-swiper-tab{
		border-bottom: 1upx solid #EEEEEE;
	}
</style>
